<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="com.yy.base.util.UserUtil"%>
<%
if (session.getAttribute(UserUtil.USERSESSION) == null) {
	response.sendRedirect(request.getContextPath());
	return;
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>数据采集</title>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<script src="../../script/mes-import.js"></script>
	<script src="../../script/js/layui/layui.all.js"></script>
	<script src="js/dataCollection.js"></script>
</head>
<body style="padding: 10px;" id="manuDataCollection">
<form class="layui-form" action="" lay-filter="myForm" >
	<div class="layui-form-item">
		<div class="layui-input-inline" >
			<label class="layui-form-label" style="text-align: right;">RFID：</label>
			<div class="layui-input-block">
				<input type="text" name="code" id="code" lay-verify="code" readLocaRfid="true" autocomplete="off" placeholder="请扫描RFID" class="layui-input">
			</div>
		</div>
		<div class="layui-input-inline" id="userCodePanel" style="display: none;">
			<label class="layui-form-label" style="text-align: right;">工号：</label>
			<div class="layui-input-block">
				<input type="text" name="userCode" id="userCode" lay-verify="userCode" autocomplete="off" placeholder="请扫描员工工号" class="layui-input">
			</div>
		</div>
	</div>

	<div class="layui-form-item" id="orderInfoPanel" style="margin-top : 20px;display: none;">
        <label class="layui-form-label"></label>
        <div class="layui-input-block" id="orderInfo">工单信息</div>
    </div>
    <div class="layui-form-item" style="display: none;">
		<div class="layui-input-inline">
			<label class="layui-form-label">当前工序：</label>
			<div class="layui-input-block">
				<select name="processId" id="processId" lay-verify="processId" style="max-width: 400px;">
					<option value="">--请选择--</option>
					<option v-for="p in processList" value="{{p.emes_process_id}}">{{p.name}}</option>
				</select>
			</div>
		</div>
    </div>
	<div class="row" id="facInputPanel" style="display: none;">
		<div class="layui-form-item">
			<div class="layui-input-inline">
				<label class="layui-form-label">设备编码:</label>
				<div class="layui-input-block">
					<input id="facCode" name="facCode" placeholder="请扫描设备编码" autocomplete="off" class="layui-input"/>
					<img src="../../script/imgs/scan.png" scanButton onclick="scan('facCode')"  />
				</div>
			</div>
			<div class="layui-input-inline" id="facInfoPanel">
				<label class="layui-form-label"></label>
				<div class="layui-input-block" id="facInfo"></div>
			</div>
		</div>
	</div>


	<div style="position: absolute;top: 12px;right: 50px;">
		<div class="layui-input-block">
			<button type="button"  style="width: 111px" class="layui-btn layui-btn-normal" onclick="showDocument()">工艺指导文件</button>
		</div>
	</div>
	<div style="position: absolute;top: 75px;right: 50px;">
		<div class="layui-input-block">
			<button type="button"  style="width: 111px" class="layui-btn layui-btn-normal" @click="">图案</button>
		</div>
	</div>
	<div style="position: absolute;top: 137px;right: 50px;">
		<div class="layui-input-block">
			<button type="button"  style="width: 111px" class="layui-btn layui-btn-normal" onclick="abnormalReport()">异常上报</button>
		</div>
	</div>
	<div class="layui-row" style="margin-top: 40px">
		<div class="layui-input-inline" style="float:left;">
			<div class="layui-input-block">
				<span  class="layui-btn layui-btn-normal" >报工历史</span>
			</div>
		</div>
	</div>
</form>
<table class="layui-hide" id="cdJobListTable" lay-filter="remakeReceiveFilter"></table>
<script>
var vm = new Vue({
	el:'#manuDataCollection',
	data:{
		hisDataList: [],
		Dc_Btn_List: [],
		processList: [],
		cloumnList : [],
        cols_arr: [],
        showRework: false,
		showAddMatBtn: false,	//显示加料按钮
		reworkText: "返工"		//返工按钮文本
	},
	methods:{
		isEmpty:function(obj){//判断对象是否为空
			if(typeof obj == "undefined" || obj == null || obj == ""){
				return true;
			}else{
				return false;
			}
		}
	},


	watch:{
		hisDataList:{
			handler: function(curVal,oldVal){
                hisDataList = oldVal[0].DATA;
                cloumnList = oldVal[0].COLUMN;
                var _self = this;
                _self.cols_arr[0] = [];
                _self.cols_arr[0][0] = {type:'numbers', title: '序号', align: 'center'};
                for(i = 0;i< cloumnList.length;i++){
                    _self.cols_arr[0][i+1] = {field:cloumnList[i].SAVE_COLUMN.toUpperCase(), title: cloumnList[i].NAME,width: 150, align: 'center'};
                }
                layui.use(['form','table','laydate'], function(){
                    _self.table = layui.table;
                    var form = layui.form;

                    _self.table.render({
                        elem: '#cdJobListTable',
                        width: 'full-20',
                        height: 'full-150',
                        cols: _self.cols_arr,
                        data:hisDataList,
                        page: true, //是否显示分页
                        limits: [10, 20, 50],
                        limit: 15 //每页默认显示的数量
                    });
                });
			},
			deep:true
		}
	}
});
// 异常上报
function abnormalReport() {
    layer.open({
        type: 2,
        title: '异常上报',
        shadeClose: true,
        shade: 0.8,
        area: ['90%', '90%'],
        content: "abnormalReport.html" //iframe的url
    });
}
// 显示指导文件
function showDocument() {
    if (null == this.order || '' == this.order) {
        layer.msg("请扫描RFID")
        return
    }

    layer.open({
        type: 2,
        title: '工艺指导文件',
        shadeClose: true,
        shade: 0.8,
        area: ['90%', '90%'],
        content: "../../script/js/pdfJs/web/viewer.html?file=../../../../manNeedleCart/downFile/" + this.order //iframe的url
    });
}
</script>
</body>
</html>